#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int delSubStr(char *src,char *sub,char *result);
int main()
{
	char src[100]={'\0'};
	char sub[3];
	char result[100]={'\0'};
	int nu;
	scanf("%s",src);      
	scanf("%s",sub);
	printf("%s",src);
	printf("\n");
	nu=delSubStr(src,sub,result);
	printf("%s",result);
	printf("\n");
	printf("%d",nu);
	return 0;
}


int delSubStr(char *src, char *sub,char *result)
{
	char *p;
	p=src;
	int i=0,size=1,num=0;
	int sign=0;
	size=strlen(sub);
	do
	{
		if(*p==sub[0]&&sign>=0)
		{
			sign=strncmp(p,sub,size);
			if(sign==0)
			{
				p+=size;
				num++;                    
			}
                        
		} 
		else 
		{         
			puts(p);
			result[i++]=*p++;		
		}
	}while(*p!='\0');
	return num;
}



